// const { defineConfig } = require('@vue/cli-service')
// module.exports = defineConfig({
//   transpileDependencies: true
// })
const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}
module.exports = {
  outputDir: 'dist',
  // lintOnSave: false, //放开关闭eslint
  publicPath: '/',
  chainWebpack: () => { },
  productionSourceMap: process.env.NODE_ENV === 'dev',
  configureWebpack: {
    devtool: process.env.NODE_ENV === 'dev' ? 'source-map' : undefined,
    name: "my-blog-web",
    resolve: {
      alias: {
        '@': resolve('src') //使用 @/ 的引用都会直接指向 src 目录
      }
    }
  },
  css: {
    loaderOptions: {
      sass: {
        additionalData: `@import '~@/assets/styles/variables.scss'; @import "~@/assets/styles/mixin.scss"; @import '~@/assets/styles/common.scss'; @import '~@/assets/styles/animation.scss';`
      }
    }
  },
  devServer: {
    proxy: {
      '/api': {
        target: process.env.VUE_APP_BASE_API,
        ws: true,
        secure: false, // 如果是https接口，需要配置这个参数
        changeOrigin: true,
        // 忽略前缀路径 它是一个对象 里面是key value
        // 这个正则意思是 如果前缀是/api,那么会替换成空字符
        pathRewrite: { '^/api': '' }

      }
    }
  }
}